package com.jdrx.sw.sewage.common.enums;

import com.jdrx.sw.sewage.common.constant.Constant;

public enum ECommandStatus {
    CMD_WAITING_TO_SEND(0, "命令待发送"),
    CMD_SEND_IN_PROGRESS(1, "命令发送中"),
    CMD_SEND_TO_DEVICE(2, "命令发送到设备"),
    CMD_SEND_FAIL(3, "命令发送失败"),
    CMD_SEND_TIMEOUT(4, "命令发送超时"),
    CMD_EXECUTE_SUCCESS(5, "命令执行完成"),
    CMD_EXECUTE_FAIL(6, "命令执行失败"),
    CMD_PARAMS_ERROR(7, "命令参数错误"),
    CMD_PARSE_ERROR(8, "命令解析错误"),
    GATEWAY_OFFLINE(9, "网关离线");

    private Integer key;
    private String value;

    ECommandStatus(Integer key, String value) {
        this.key = key;
        this.value = value;
    }

    public static String getName(Integer key) {
        for (ECommandStatus status : ECommandStatus.values()) {
            if (key.equals(status.getKey())) {
                return status.getValue();
            }
        }
        return Constant.EMPTY;
    }

    public Integer getKey() {
        return key;
    }

    public void setKey(Integer key) {
        this.key = key;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }
}
